package cn.kgc.spring;


import cn.kgc.spring.entity.Student;
import cn.kgc.spring.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {

        // 获取一个user实例  spring   IOC

        // 获取spring容器
        ApplicationContext ac = new ClassPathXmlApplicationContext("config/spring-config.xml");
        // User user = (User) ac.getBean("user");
        // System.out.println("user = " + user);
        User user = ac.getBean("user", User.class);
        System.out.println("user = " + user);

        System.out.println("-----------------------");

        Student student = ac.getBean("student", Student.class);
        System.out.println("student = " + student);


    }
}
